package cn.hl.sfzy.service.impl;

import cn.hl.sfzy.entity.Heartmark;
import cn.hl.sfzy.mapper.HeartmarkMapper;
import cn.hl.sfzy.service.HeartmarkService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HeartmarkServiceImpl implements HeartmarkService {
    @Autowired
    private HeartmarkMapper heartmarkMapper;

    @Override
    public int add(Heartmark heartmark) {
        int i = heartmarkMapper.addAll(heartmark);;
        return i;
    }

    @Override
    public int deleteById(Long id) {
        return heartmarkMapper.deleteById(id);
    }


    @Override
    public int update(Heartmark heartmark) {
        int update = heartmarkMapper.update(heartmark);
        return update;
    }

    @Override
    public PageInfo<Heartmark> findBypage(int pageNum, int pageSize, Heartmark heartmark) {
        PageHelper.startPage(pageNum, pageSize);
        List<Heartmark> select = heartmarkMapper.findAll(heartmark);
        PageInfo pageHelper = new PageInfo<Heartmark>(select);
        return pageHelper;
    }
}
